﻿<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" id=”viewport” content="initial-scale=1.0,user-scalable=no">
	<link href="http://code.jquery.com/mobile/latest/jquery.mobile.min.css" rel="stylesheet" type="text/css" />
    <script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
    <script src="http://code.jquery.com/mobile/latest/jquery.mobile.min.js"></script>
	
</head> 
<body> 
    <script>
            jQuery.support.cors = true;
            var productServiceUrl = 'http://127.0.0.1:8080/ENT.PM.Ws/Service.asmx?op=Sum'; // Preferably write this out from server side
			function endSaveProduct(xmlHttpRequest, status)
			{
			    alert("xmlHttpRequest.responseXML=" + xmlHttpRequest.readyState + ",status=" + xmlHttpRequest.responseText);
				/*
				 $(xmlHttpRequest.responseXML)
					.find('sayit')
					.each(function()
				 {
				   var name = $(this).find('Name').text();
				 }*/
			}	
			function beginSaveProduct()
			{
					var soapMessage =
					'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> \
					<soap:Body> \
					 <Sum xmlns="http://172.16.17.33:8080/ENT.PM.Ws/">\
					  <x>3</x>\
					</Sum>\
					</soap:Body> \
					</soap:Envelope>';

					$.ajax({
					url: productServiceUrl,
					type: "POST",
					dataType: "xml",
					data: soapMessage,
					complete: endSaveProduct,
					error: function (req, status, error) {
				    			alert("error="+req + ", " + status + ", " + error);
					},
					contentType: "text/xml; charset=\"utf-8\""
					});

					return false;
			}
					
       
			$(document).ready(function(){
				$('#btn').click(function() 
				{
					try
					{ 
					   
						beginSaveProduct();
						 alert("ks!");
					} catch(e) { alert ("Error Message: " + e.message);}
				});
					  
        	});  

    </script>
	<div data-role="page">
    <div data-role="header">
        <h1> Login</h1>
    </div>
    <div data-role="content">
	   <div data-role="fieldcontain">
			<label for="name">Usuario:</label>
			<input type="text" name="name" id="name" value=""  />
		</div>
       <div data-role="fieldcontain">
			<label for="clave">Clave:</label>
			<input type="text" name="clave" id="clave" value=""  />
			<input id="callAjax" type="button" value="Call Ajax 1" />
		</div>
		
        <div id="resultLog"></div>
		<div>
			<button id='btn'>Load It</button>
			<div id='sayit'></div>
		</div>
		
        <script>

/*
$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?",
  {
    tags: "dog",
    tagmode: "any",
    format: "json"
  },
  function(data) {
    $.each(data.items, function(i,item){
      $("<img/>").attr("src", item.media.m).appendTo("#resultLog");
      if ( i == 3 ) return false;
    });
  });
$.getJSON("http://172.16.17.33:8080/ENT.PM.Ws/Service.asmx/GetLogin=?",
		  {
			sUsername: "cat",
			sPassword: "any"
		  },
		  function(data) {
		   alert(data);
		  });*/
  
  
  
  </script>
        
		<a href="index.html" data-role="button" data-inline="true">Inicio</a>
    </div>
</div>
</body>
</html>
